package Test;

import java.util.ArrayList;
import java.util.List;
import java.util.Vector;

import org.junit.Test;

import com.surekam.library.model.FuncPergroup;
import com.surekam.library.model.Operator;
import com.surekam.library.model.Reader;
import com.surekam.library.view.common.TableModuleSyntaxAnalyse;

public class TableModuleSyntaxAnalyxTest {

	@Test
	public static void main(String[] args) {
		
		List<Reader> dataList = new ArrayList<Reader>() ;
		Reader reader = new Reader() ;
		reader.setE_mail("304091425@qq.com");
		reader.setIdCard("430903199010174514");
		reader.setPassword("caoxu");
		Operator operator = new Operator();
		operator.setOperator_id(1);
		operator.setOperator_name("admin");
		operator.setState(true);
		
		FuncPergroup funcPergroup = new FuncPergroup();
		funcPergroup.setFuncPergroupName(12);
		operator.setFuncPergroup(funcPergroup);
		reader.setOperator(operator);
		
		dataList.add(reader);
		
		reader = new Reader() ;
		reader.setE_mail("caoxu1017@sina.com");
		reader.setIdCard("430903199010174514");
		reader.setPassword("sishen");
		operator = new Operator();
		operator.setOperator_id(1);
		operator.setOperator_name("system");
		operator.setState(false);
		
		funcPergroup = new FuncPergroup();
		funcPergroup.setFuncPergroupName(21);
		operator.setFuncPergroup(funcPergroup);
		reader.setOperator(operator);
		
		dataList.add(reader);
		
		List<String> fieldNameList = new ArrayList<String>();
		fieldNameList.add("e_mail");
		fieldNameList.add("idCard");
		fieldNameList.add("password");
		fieldNameList.add("operator.operator_id");
		fieldNameList.add("operator.operator_name");
		fieldNameList.add("operator.funcPergroup.FuncPergroupName");
		fieldNameList.add("operator.state");
		
		TableModuleSyntaxAnalyse table = new TableModuleSyntaxAnalyse(fieldNameList , dataList);
		
		Vector<Vector<Object>> data =table.getDataVectors();
		
		Vector<Object> vector = null ;
		for(int i = 0 ; i < data.size() ;i++) {
			
			vector= data.get(i) ;
			
			for (int j = 0; j < vector.size(); j++) {
				
				System.out.println(vector.get(j));
			}
		}
	}
}
